package com.zff.rental.controller.apartment;


import com.zff.rental.AppConstant;
import com.zff.rental.common.PageVo;
import com.zff.rental.common.Result;
import com.zff.rental.service.apartment.ApartmentServer;
import com.zff.rental.vo.apartment.apartment.ApartmentListParams;
import com.zff.rental.vo.apartment.apartment.ApartmentVo;
import com.zff.rental.vo.apartment.apartment.RecommendApartmentListParams;
import com.zff.rental.vo.apartment.apartment.RecommendApartmentVo;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**
 * 公寓
 *
 * @author HCY
 */
@RestController
@RequestMapping(AppConstant.RM_APARTMENT)
public class ApartmentController {
    @Resource
    private ApartmentServer apartmentServer;

    /**
     * 公寓列表
     */
    @PostMapping("/list")
    public Result<PageVo<ApartmentVo>> list(@RequestBody ApartmentListParams params) {
        PageVo<ApartmentVo> result = apartmentServer.list(params);
        return Result.success(result);
    }

    /**
     * 推荐公寓列表
     */
    @PostMapping("/recommend")
    public Result<PageVo<RecommendApartmentVo>> recommend(@RequestBody RecommendApartmentListParams params) {
        PageVo<RecommendApartmentVo> apartmentVoPageVo = apartmentServer.recommend(params);
        return Result.success(apartmentVoPageVo);
    }

    /**
     * 公寓详情
     */
    @GetMapping("/details")
    public Result<ApartmentVo> details(@RequestParam("id") Long id) {
        ApartmentVo result = apartmentServer.details(id);
        return Result.success(result);
    }
}